#pragma once

#include "db/DBPool.h"
#include "db/mysql/MysqlDB.h"

inline void dbpool_test()
{
    DBConfig config;
    config.Host = "localhost";
    config.Port = 3306;
    config.User = "root";
    config.Password = "newpassword";
    config.Database = "new_account";
    config.Charset = "gbk";
    DBPool<MysqlDB> db;
    db.init(config, 0, 2);
    {
        auto c1 = db.get_conn();
        auto c2 = db.get_conn();
        auto c3 = db.get_conn();

        assert(c1 && c2 && !c3);
    }
   
    {
        auto c1 = db.get_conn();
        auto c2 = db.get_conn();
        auto c3 = db.get_conn();

        assert(c1 && c2 && !c3);
    }
    
}